#pragma once

namespace DuiLib
{
	class CAbstractItemModel;

	// QModelIndex
	class UILIB_API CModelIndex
	{
		friend class CAbstractItemModel;

	public:
		CModelIndex();
		~CModelIndex();
		
		bool isValid() const;

		int row() const;
		int column() const;

		CModelIndex parent() const;
		CModelIndex sibling(int row, int col) const;
		CModelIndex child(int row, int col) const;

		int childCount() const;

		const CAbstractItemModel* model() const;
		const void* interPtr() const;

		CVar data() const;


		bool operator ==(const CModelIndex& index) const;
		bool operator !=(const CModelIndex& index) const;
		bool operator <(const CModelIndex& index) const;

	private:
		CModelIndex(int row, int col, const void* interPtr, const CAbstractItemModel* model);

		int _row;
		int _column;

		const CAbstractItemModel* _model;
		const void* _interPtr;
	};

}